package com.shengxi.mqtt;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/mqtt")
public class MqttController {

    @Autowired
    private MyMqttClient myMqttClient;

    @GetMapping("/push")
    public String publish(String message) {
        log.info("调用接口推送消息:{}", message);
        myMqttClient.publish("hello", "/xyf");
        return "success";
    }

}
